const northRoom = new Set([442,443,437,434,433,538,537,532,529,528])
const allRoom = new Set([442,443,437,434,433,538,537,532,529,528,101,105,106,107,201,203,206,207,208,211,215,216,217,
    301,303,306,307,308,311,312,314,315,316,318,320,401,403,406,407,408,411,412,414,415,416,418,419,421,422,425,426,
    501,502,503,506,507,509,510,511,513,514,516,517,520,521,
    601,602,603,605,606,608,609,612,613,701,703,706,707
])

const e33 = new Set([314,315,316,318,320])
const e34 = new Set([307,308,311,312])
const e35 = new Set([301,303,306])


const getEntry = (room)=>{
    if(northRoom.has(room)) return ['入口2'];
    if(room < 200) return ['入口5'];
    if(room <300) {
        if(room == 216 || room == 217) return ['入口4right'];
        if(room == 211 || room == 208) return ['入口4left'];
        else return ['入口5'];
    }
    if(room < 400) {
        if(e33.has(room)) return ['入口3'];
        if(e34.has(room)) return ['入口4'];
        return ['入口5'];
    }
    if(room < 600) return ['入口1','入口3','入口4','入口5'];
    if(room < 700) return ['入口1','入口3','入口4','入口5'];
    return ['入口1','入口3'];
}

const getImg = (room) => {
    room = Number(room);
    const floor = parseInt(room/100);
    try {
      if(northRoom.has(room)) {
        return new URL(`../assets/F${floor}N.drawio.png`, import.meta.url).href;//重要的
      } else {
        
        return new URL(`../assets/F${floor}.drawio.png`, import.meta.url).href;
      }
    } catch(e) {
      console.error('图片加载失败:', e);
      return ''; // 返回默认图片或空字符串
    }
  }
  

const Points = new Map([
    ['入口51',{x:540,y:74}],

    ['入口42',{x:250,y:43}],
    ['入口52',{x:782,y:160}],
    ['入口4right2',{x:176,y:140}],
    ['入口4left2',{x:300,y:160}],

    ['入口33',{x:290,y:152}],
    ['入口43',{x:990,y:140}],
    ['入口53',{x:1460,y:140}],

    ['入口14',{x:60,y:280}],
    ['入口34',{x:960,y:190}],
    ['入口44',{x:1715,y:190}],
    ['入口14',{x:2320,y:190}],

    ['入口15',{x:60,y:270}],
    ['入口35',{x:960,y:190}],
    ['入口45',{x:1715,y:190}],
    ['入口55',{x:2320,y:190}],

    ['入口16',{x:60,y:280}],
    ['入口36',{x:960,y:190}],
    ['入口46',{x:1715,y:190}],

    ['入口17',{x:60,y:280}],
    ['入口37',{x:960,y:190}],

    ['入口24',{x:250,y:70}],
    ['入口241',{x:270,y:145}],

    ['楼梯4',{x:750,y:100}],

    ['入口25',{x:500,y:200}],
    ['入口251',{x:500,y:240}],


    [101,{x:700,y:140}],
    [105,{x:380,y:140}],
    [106,{x:220,y:140}],
    [107,{x:60,y:140}],

    [217,{x:40,y:200}],
    [216,{x:140,y:200}],
    [211,{x:340,y:200}],
    [208,{x:460,y:200}],
    [207,{x:580,y:200}],
    [206,{x:700,y:200}],
    [203,{x:820,y:200}],
    [201,{x:940,y:200}],

    [321,{x:80,y:170}],
    [320,{x:200,y:170}],
    [318,{x:380,y:170}],
    [316,{x:500,y:170}],
    [315,{x:620,y:170}],
    [314,{x:740,y:170}],
    [312,{x:860,y:170}],
    [311,{x:980,y:170}],
    [308,{x:1100,y:170}],
    [307,{x:1220,y:170}],
    [306,{x:1340,y:170}],
    [303,{x:1460,y:170}],
    [301,{x:1580,y:170}],

    [426,{x:200,y:280}],
    [425,{x:350,y:280}],
    [422,{x:500,y:280}],
    [421,{x:650,y:280}],
    [419,{x:800,y:280}],
    [418,{x:950,y:280}],
    [416,{x:1109,y:280}],
    [415,{x:1250,y:280}],
    [414,{x:1400,y:280}],
    [412,{x:1550,y:280}],
    [411,{x:1700,y:280}],
    [408,{x:1850,y:280}],
    [407,{x:2000,y:280}],
    [406,{x:2150,y:280}],
    [403,{x:2300,y:280}],
    [401,{x:2450,y:280}],

    [521,{x:200,y:280}],
    [520,{x:350,y:280}],
    [517,{x:500,y:280}],
    [516,{x:650,y:280}],
    [514,{x:800,y:280}],
    [513,{x:950,y:280}],
    [511,{x:1109,y:280}],
    [510,{x:1250,y:280}],
    [509,{x:1400,y:280}],
    [507,{x:1550,y:280}],
    [506,{x:1700,y:280}],
    [503,{x:1850,y:280}],
    [502,{x:2000,y:280}],
    [501,{x:2300,y:280}],

    [613,{x:200,y:280}],
    [612,{x:350,y:280}],
    [609,{x:500,y:280}],
    [608,{x:650,y:280}],
    [606,{x:800,y:280}],
    [605,{x:950,y:280}],
    [603,{x:1109,y:280}],
    [602,{x:1250,y:280}],
    [601,{x:1550,y:280}],

    [707,{x:200,y:280}],
    [706,{x:350,y:280}],
    [703,{x:500,y:280}],
    [701,{x:800,y:280}],

    [433,{x:340,y:100}],
    [434,{x:475,y:100}],
    [437,{x:615,y:100}],
    [443,{x:885,y:100}],
    [442,{x:1020,y:100}],

    [528,{x:90,y:200}],
    [529,{x:226,y:200}],
    [532,{x:360,y:200}],
    [537,{x:615,y:200}],
    [538,{x:770,y:200}],
])


export {northRoom , allRoom ,Points, getEntry , getImg}
